package com.code.springbootquartz.controller;

import com.code.springbootquartz.service.JobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/*
 * @author: liyufei
 * @date: 2018-07-13 17:11
 */
@RestController
public class JobController {

    @Autowired
    private JobService jobService;

    @GetMapping("/trigger")
    public void trigger(@RequestParam("dateTime") long dateTime) {
        /*List<Long> list = new ArrayList<>();
        list.add(1531484000000L);
        list.add(1531484010000L);
        list.add(1531484020000L);
        list.add(1531484030000L);
        list.add(1531484030000L);
        list.stream().forEach(x -> jobService.createTrigger(x));*/
        jobService.createTrigger(dateTime);
    }
}
